home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / modeler / pclone.lwm < prev    next >
Text File  |  1993-12-13  |  1KB  |  71 lines

  1. /* CMD: Particle Clone
  2.  *
  3.  * Clones active layer data at offsets given by points in background
  4.  * layers.
  5.  */
  6.     mxx="LWModelerARexx.port"
  7.     signal on error
  8.     signal on syntax
  9.     mxx_add = addlib(mxx,0)
  10.     call main
  11.     if (mxx_add) then call remlib(mxx)
  12.     exit
  13.  
  14.     syntax:
  15.     error:
  16.     t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
  17.     if (mxx_add) then call remlib(mxx)
  18.     exit
  19.  
  20.  
  21. MAIN:
  22.  
  23. syscode = "Particle Clone"
  24. tmpnam = "t:pclone.tmp"
  25.  
  26.  
  27. /* Store current and background layers.
  28.  */
  29. fg = curlayer()
  30. bg = curblayer()
  31.  
  32.  
  33. /* Use xfrm mode to scan through points, storing coordinates to tmp file.
  34.  */
  35. if (~open(plist, tmpnam, 'W')) then return
  36.  
  37. call setlayer(bg)
  38. n = xfrm_begin()
  39. if (n = 0) then do
  40.     call close(plist)
  41.     return
  42. end
  43.  
  44. call meter_begin(n, syscode, "Reading Points")
  45. do i=1 to n
  46.     call writeln(plist, xfrm_getpos(i))
  47.     call meter_step()
  48. end i
  49. call meter_end()
  50. call xfrm_end()
  51.  
  52. call close(plist)
  53.  
  54.  
  55. /* Read the point coordinates back in and replicate fg data using
  56.  * their positions as offsets.
  57.  */
  58. if (~open(plist, tmpnam, 'R')) then return
  59.  
  60. call setlayer(fg)
  61. call repl_begin(COPY)
  62. call meter_begin(n, syscode, "Generating Clones")
  63. do i=1 to n
  64.     call repl_step(readln(plist), 1, 0)
  65.     call meter_step()
  66. end i
  67. call meter_end()
  68. call repl_end()
  69.  
  70. return
  71.